#ifndef __DBCONNECTION_DFARM_H_
#define __DBCONNECTION_DFARM_H_

#include "Farm.h"

class DFarm : public Farm
{
	public:
/*
 * writers = db1.corp.cnb:3306, db2.corp.cnb:3306
 * readers = db1.corp.cnb:3306, db2.corp.cnb:3306
 */
		DFarm(DbParam dbParameters, const char *writers, const char *readers, bool debug=false); 
		MYSQL *GetReader();
		MYSQL *GetWriter(int idx);
		void CloseConnection(MYSQL *c, bool write = false);
		int GetWriterSize() { return writers_.size(); }
                void Print();
		~DFarm() {}
	protected:
		void closeAll();
		MYSQL *getNextReader(int &num, int size);
		vector< DbHost * > readers_;
		vector< DbHost * > writers_;
};

#endif
